package com.xiashitech.agent.instrumentation.context;

public class XSCallDepthThreadLocalMap {
    private static final ClassValue<XSCallDepthThreadLocalMap.ThreadLocalXSDepth> TLS = new ClassValue<XSCallDepthThreadLocalMap.ThreadLocalXSDepth>() {
        protected XSCallDepthThreadLocalMap.ThreadLocalXSDepth computeValue(Class<?> type) {
            return new XSCallDepthThreadLocalMap.ThreadLocalXSDepth();
        }
    };

    static XSCallDepth getCallDepth(Class<?> k) {
        return (XSCallDepth)((XSCallDepthThreadLocalMap.ThreadLocalXSDepth)TLS.get(k)).get();
    }

    private XSCallDepthThreadLocalMap() {
    }

    private static final class ThreadLocalXSDepth extends ThreadLocal<XSCallDepth> {
        private ThreadLocalXSDepth() {
        }

        protected XSCallDepth initialValue() {
            return new XSCallDepth();
        }
    }
}
